<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="Content-Type" content="multipart/form-data; charset=utf-8" />
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <!--[if lt IE 9]>
    <script type="text/javascript" src="http://libs.useso.com/js/html5shiv/3.7/html5shiv.min.js"></script>
    <script type="text/javascript" src="http://libs.useso.com/js/respond.js/1.4.2/respond.min.js"></script>
    <script type="text/javascript" src="http://cdn.bootcss.com/css3pie/2.0beta1/PIE_IE678.js"></script>
    <![endif]-->
    <link type="text/css" rel="stylesheet" href="/static/static/h-ui/css/H-ui.css"/>
    <link type="text/css" rel="stylesheet" href="/static/static/h-ui.admin/css/H-ui.admin.css"/>
    <!--<link type="text/css" rel="stylesheet" href="font/font-awesome.min.css"/>-->
    <!--[if IE 7]>
    <link href="http://www.bootcss.com/p/font-awesome/assets/css/font-awesome-ie7.min.css" rel="stylesheet" type="text/css" />
    <![endif]-->
    <link rel="stylesheet" href="/static/static/h-ui/css/loading.css">
    <script type="text/javascript" src="/static/js/loading.js"></script>
    <title>上传文件</title>
</head>
<body>
<div class="pd-20">
    <div class="Huiform">
        <form id="uploadForm" enctype="multipart/form-data">
            文件 :  <input type="file" name="file" multiple="multiple"/><br>
        </form>
        <br/>
        <br/>
        <button id="upload">上传文件</button>
    </div>
</div>
<script type="text/javascript" src="/static/static/jquery-3.4.1.min.js"></script>
<script type="text/javascript" src="/static/static/h-ui/js/H-ui.js"></script>
<script type="text/javascript" src="/static/static/h-ui.admin/js/H-ui.admin.js"></script>

<script type="text/javascript">
    $(function () {
        $("#upload").click(function () {
            var formData = new FormData($('#uploadForm')[0]);
            $.ajax({
                type: 'post',
                url: "/file/upload",
                data: formData,
                cache: false,
                processData: false,
                contentType: false,
                success:function (data) {
                    if (data.success){
                        alert(data.msg);
                        window.location.href = "/front/file-list";
                    }else {
                        alert(data.msg);
                        window.location.href = "/front/file-add";
                    }
                }
            })
        });
    });
</script>

</body>
</html>